/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
function short_url_clear(){
    var short_url = $("#short_url").val();
    if(short_url == '输入需要缩短的网址'){
        $("#short_url").val('');
    }
}

function html_tr(u22, sina, tencent, url,k,total_pv,total_ip){
    var str= "";
//    var top = $("#list_first").html();
//    top     = "<tr id='list_first'>"+top +"</tr>";
//    $("#list_first").remove();
//    var last    = $("#list_url > tbody").html();
    str +='<tr>';
	str +='<td>'+total_pv+'pv / '+total_ip+'ip</td>';
	//str +='<td><input id="copy_'+sina+k+'" type="hidden" value="http://t.cn/'+sina+'"/>http://t.cn/'+sina+'<span class="copy"><a href="#" class="my_clip_button" id="copy_button_'+sina+k+'">复制</a></span></td>';
	//str +='<td><input id="copy_'+tencent+'" type="hidden" value="http://url.cn/'+tencent+'"/>http://url.cn/'+tencent+'<span class="copy"><a href="#" id="copy_button_'+tencent+'">复制</a></span></td>';
	//str +='<td><input id="copy_'+tencent+k+'" type="hidden" value="http://u22.cc/'+tencent+'"/>http://url.cn/'+tencent+'<span class="copy"><a href="#" id="copy_button_'+tencent+k+'">复制</a></span></td>';
	str +='<td><input id="copy_'+u22+k+'" type="hidden" value="http://u22.cc/'+u22+'"/>http://u22.cc/'+u22+'<span class="copy"><a href="#" id="copy_button_'+u22+k+'">复制</a></span></td>';

        str +='<td><a href="http://u22.cc/'+u22+'+">'+u22+'</a></td>';
	str +='<td>'+url+'</td>';
	//str +='<td><span class="more"><a href="#">更多&nbsp;<img src="/theme/default/u22/images/more.gif"></a></span></td>';
    str +='</tr>';
    //$("#list_url").html(top+str+last);
    //copy_short(u22, sina, tencent);
    return str;
}

function set_copy(data){
        $.each(data, function(k1,v1){
        var clip_sina,clip_tencent,u22,news;
//            clip_sina = new ZeroClipboard.Client();
//            clip_sina.setHandCursor( true );
//            clip_sina.setText( $('#copy_'+v1.sina_url+k1).val());
//            clip_sina.glue( 'copy_button_'+v1.sina_url+k1);
//            //clip_sina.reposition();
//            clip_sina.addEventListener( "complete", function(){
//                alert("复制成功！");
//            });


            u22 = new ZeroClipboard.Client();
            u22.setHandCursor( true );
            u22.setText( $('#copy_'+v1.uhash+k1).val());
            u22.glue( 'copy_button_'+v1.uhash+k1);
            u22.addEventListener( "complete", function(){
                alert("复制成功！");
            });
            
//            news = new ZeroClipboard.Client();
//            news.setHandCursor( true );
//            news.setText( $('#copy_'+v1.tencent_url+k1).val());
//            news.glue( 'copy_button_'+v1.tencent_url+k1);
//            news.addEventListener( "complete", function(){
//                alert("复制成功！");
//            });
    });
}

function copy_short(u22, sina, tencent) {
    var cp1,cp2,cp3;
    cp1 = new ZeroClipboard.Client();
    cp1.setHandCursor( true );
    cp1.setText( $('#copy_'+u22).val());
    cp1.glue( 'copy_button_'+u22);
    cp1.reposition();

    cp2 = new ZeroClipboard.Client();
    cp2.setHandCursor( true );
    cp2.setText( $('#copy_'+sina).val());
    cp2.glue( 'copy_button_'+sina);
    cp2.reposition();
}

